package l.l.w.leetcode._041_FirstMissingPositive;

/**
 * Created by llw on 2018/5/22/0022.
 */
public class _041_FirstMissingPositive {
    public int firstMissingPositive(int[] nums) {
        if (nums == null || nums.length == 0) return 0;
        int start = 0, end = nums.length - 1;
        int[] bound = new int[2];
        int k = 0;
        int negativeLength = de(nums, start, end, 0, bound);
        start = negativeLength + 1;
        if (start - negativeLength < bound[0])
            return start - negativeLength;
        while (start <= end) {
            int index = de(nums, start, end, nums[start], bound);
            if (start - negativeLength < bound[0])
                return start - negativeLength;
            if (end - start < bound[1] - bound[0]) {
                end = index;
            } else {
                start = index;
            }
        }
        return 0;
    }

    // 对于数组 nums 在start 和 end 区间，按 k进行切分
    // bound[0]表示小于k的最小值，bound[1]表示小于k的最大值
    private int de(int[] nums, int start, int end, int k, int[] bound) {
        for(int i = start; i <= end; ++i){

        }
        return 0;
    }
}
